Skip to content

[SEA-NodeJS] feat(kernel): proxy + socketTimeout ConnectionOptions on the kernel backend#431

Merged
msrathore-db merged 4 commits into
mainfrom
msrathore/kernel-proxy-connection-option
Jun 10, 2026
Merged

[SEA-NodeJS] feat(kernel): proxy + socketTimeout ConnectionOptions on the kernel backend#431
msrathore-db merged 4 commits into
mainfrom
msrathore/kernel-proxy-connection-option

Conversation

@msrathore-db

@msrathore-db msrathore-db commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

What

Wires two transport ConnectionOptions through to the kernel/SEA backend, at Thrift parity:

  1. proxy: { protocol, host, port, auth } — the same structured proxy option the Thrift path accepts now also routes kernel/SEA traffic. buildKernelProxyOptions composes protocol://[user:pass@]host:port (credentials percent-encoded into the userinfo) and forwards it to the kernel napi proxy?: string (kernel ProxyConfig.url).
  2. socketTimeout (ms) — mapped onto the kernel napi socketTimeoutMs (kernel HttpConfig::request_timeout / reqwest Client::timeout) in buildKernelHttpOptions. Only a positive value is forwarded; socketTimeout: 0 ("disabled") is omitted so reqwest keeps its large default rather than timing out immediately.

The regenerated napi contract (native/kernel/index.d.ts) picks up the proxy?: string + socketTimeoutMs?: number fields from the kernel side — databricks/databricks-sql-kernel#129 (required companion).

Note: env-var proxying (HTTPS_PROXY / HTTP_PROXY / NO_PROXY) already worked on the kernel backend (reqwest honours those natively). This PR adds the programmatic path for callers who cannot set process env vars.

Verification

End-to-end via mitmproxy, useKernel: true against a live serverless SQL warehouse, plus the driver-test suite:

  • explicit proxy (no env var) → every SEA call (POST /sessions, POST /statements, GET …, DELETE …) intercepted; SELECT returns the expected row.
  • dead proxy port → connection fails after retries (proves the explicit proxy is genuinely used).
  • socketTimeout: 1 → a live SEA request times out (read-timeout fires).
  • driver-test HttpProxyTests (SEA leg): http / https / proxy-with-auth all pass through mitmproxy.
  • eslint + prettier clean; tsc build green.

Dependency

Requires kernel PR databricks/databricks-sql-kernel#129 (the napi proxy / socketTimeoutMs fields). The contract bump in native/kernel/index.d.ts reflects that binding.

This pull request and its description were written by Isaac.

@github-actions

Copy link
Copy Markdown

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

@msrathore-db msrathore-db changed the title [SEA-NodeJS] feat(kernel): support the explicit proxy ConnectionOption on the kernel backend [SEA-NodeJS] feat(kernel): proxy + socketTimeout ConnectionOptions on the kernel backend Jun 10, 2026
@github-actions

Copy link
Copy Markdown

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

@github-actions

Copy link
Copy Markdown

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

…n on the kernel backend

Map the public Thrift-shaped `ConnectionOptions.proxy`
(`{protocol, host, port, auth}`) onto the kernel napi binding's
`proxy?: string`, so the SAME proxy connection option that works on the
Thrift backend now also routes kernel/SEA traffic through a proxy.

`buildKernelProxyOptions` composes `protocol://[user:pass@]host:port`,
percent-encoding any `auth.{username,password}` into the URL userinfo so
credentials with reserved characters survive; the kernel parses the
userinfo off and applies it as proxy basic-auth. Wired into
`buildKernelConnectionOptions` alongside the TLS / HTTP option builders.

The regenerated napi contract (`native/kernel/index.d.ts`) carries the
new `proxy?: string` and `socketTimeoutMs?: number` fields exposed by the
kernel PR (databricks/databricks-sql-kernel#129).

Note: env-var proxying (`HTTPS_PROXY` / `HTTP_PROXY` / `NO_PROXY`) already
worked on the kernel backend (reqwest honours it natively); this adds the
*programmatic* path for callers who cannot set process env vars.

Verified end-to-end via mitmproxy against a live serverless warehouse:
explicit `proxy` option (no env var) routes all SEA calls through the
proxy; a dead proxy port fails the connection (proving the proxy is used).

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
…o the kernel

The kernel napi binding exposes `socketTimeoutMs` (kernel
`HttpConfig::request_timeout` / reqwest `Client::timeout`, kernel #129).
Map the public `socketTimeout` ConnectionOption (ms) onto it in
`buildKernelHttpOptions`, so the per-connection read timeout works on the
kernel backend just like the Thrift path.

Only a positive value is forwarded: `socketTimeout: 0` means "disabled /
wait indefinitely" on Thrift, but forwarding `0` would make reqwest time
out immediately, so it is omitted (kernel keeps its large default).

Verified directly against a live serverless warehouse: `socketTimeout: 1`
makes a SEA request time out.

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
…ed object

Change the kernel proxy mapping from a flattened URL string to the
structured napi `proxy` object (kernel #129), mirroring the kernel's
internal ProxyConfig: `{ url, username?, password?, bypassHosts? }`.

`buildKernelProxyOptions` now composes `url` from `protocol://host:port`
(no embedded credentials) and forwards `auth.{username,password}` as
separate basic-auth fields — eliminating the URL percent-encoding of
credentials. The `noProxy` host list is forwarded as `bypassHosts`
(previously unexpressible through the URL-string form).

Regenerated napi contract (native/kernel/index.d.ts) carries the new
`ProxyInput` object type.

Verified via mitmproxy (HttpProxyTests, SEA leg): http / https /
proxy-with-auth all route through the proxy and the query succeeds.

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
Point the bundled kernel binding at the latest kernel main — the v0.2.0
beta release (databricks/databricks-sql-kernel@0d46716), which includes
the merged proxy + per-connection socketTimeout napi surface (#129) this
PR maps onto, plus the query-tags wire support (#150). The kernel-e2e CI
gate builds the napi from this SHA.

Verified: proxy routes through mitmproxy and SELECT round-trips on the
v0.2.0 binding.

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
@msrathore-db msrathore-db force-pushed the msrathore/kernel-proxy-connection-option branch from af390eb to e80af04 Compare June 10, 2026 11:19
@msrathore-db msrathore-db added this pull request to the merge queue Jun 10, 2026
Merged via the queue into main with commit 93b0331 Jun 10, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants